Skip to content

fix(analytics): load GA4 tag only on production hosts - #24

Merged
rdlabo merged 1 commit into
mainfrom
devin/1788483057-ga4-production-only
Sep 4, 2026
Merged

fix(analytics): load GA4 tag only on production hosts#24
rdlabo merged 1 commit into
mainfrom
devin/1788483057-ga4-production-only

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Summary

GA4 property rdlabo-dev (properties/550016152, Asia/Tokyo) contains local development traffic: localhost + 127.0.0.1 accounted for 733 of 3,180 page_views over the latest complete 28 days (2026-08-07..09-03), ~23%. This distorts pageview and engagement figures used in the weekly analytics cycle.

Both projects/docs/src/index.html and projects/web-site/src/index.html now inject gtag.js and call gtag('config', ...) only when

/(^|\.)rdlabo\.dev$/.test(window.location.hostname)

The window.gtag stub is still defined unconditionally, so app code (app.ts page_view / article_to_* events) is unchanged; on non-production hosts the calls simply push into a dataLayer that is never consumed. Documented in marketing/analytics-access.md.

Measurement plan: localhost/127.0.0.1 sessions in GA4 should drop to 0 from the deploy date (evaluate ≥ 7 days after merge). Guardrail: production page_view volume for rdlabo.dev / docs.rdlabo.dev unchanged.

Validation: fmt:check, lint, ng test docs (48), ng test web-site (37) pass. build / seo:audit / network-dependent contract tests not run locally (allowlist blocked raw.githubusercontent.com) — rely on CI.

Link to Devin session: https://app.devin.ai/sessions/7c984b76130a4b01a1f9793370aa37bb
Open in Devin Desktop: https://app.devin.ai/desktop/session/7c984b76130a4b01a1f9793370aa37bb?variant=devin

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@netlify

netlify Bot commented Sep 4, 2026

Copy link
Copy Markdown

Deploy Preview for capacitor-plugin-docs-stripe ready!

Name Link
🔨 Latest commit 18b3b01
🔍 Latest deploy log https://app.netlify.com/projects/capacitor-plugin-docs-stripe/deploys/6a9a22263a9b4700082dd92f
😎 Deploy Preview https://deploy-preview-24--capacitor-plugin-docs-stripe.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@rdlabo
rdlabo merged commit a473c77 into main Sep 4, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant